/**
 * @author: Niimp
 * @date: 2023/5/5 14:17
 * @statement:
 */
package com.dmgis.hndz.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dmgis.hndz.service.MonitoringManagementService;
import com.dmgis.hndz.service.RiskManagementService;
import com.dmgis.hndz.common.config.DbConfig;
import com.dmgis.hndz.common.result.ResponseResult;
import com.dmgis.hndz.common.UrlHttpRequest;
import com.dmgis.hndz.pojo.*;
import com.dmgis.hndz.pojoVo.Jcca16AVo;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.*;
import java.util.stream.Collectors;

@Api(tags = "风险管理一张图")
@RestController
@RequestMapping("/riskManagementImage")
public class RiskManagementController {
    @Autowired
    private RiskManagementService riskManagementService;

    @Autowired
    private MonitoringManagementService monitoringManagementService;

    @ApiOperation(value = "行政区划查询")
    @PostMapping({"/queryAllXzqh"})
    @ResponseBody
    public ResponseResult queryAllXzqh(HttpServletRequest request) {
        try {
            Map<String, Object> map = null;
            if (request.getSession().getAttribute("ALL_XZQH") != null) {
                map = (Map<String, Object>)request.getSession().getAttribute("ALL_XZQH");
                if (map.size() > 0) {
//                    return new ResultObj("查询成功", map, true);
                    return new ResponseResult(200,true,"查询成功",map);
                }
            }
            map = this.riskManagementService.queryAllXzqh();
            if (map != null && map.size() > 0) {
                request.getSession().setAttribute("ALL_XZQH", map);
            }
//            return new ResultObj("查询成功", map, true);
            return new ResponseResult(200,true,"查询成功",map);
        } catch (Exception e) {

            e.printStackTrace();
//            return new ResultObj(e.getMessage(), null, false);
            return new ResponseResult(null,false,e.getMessage(),null);
        }
}


    /**
     * @Description:查询 行政单元-灾害点详情
     */
    @ApiOperation(value = "地图数据")
    @PostMapping(value = "queryZhcxZhd", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public ResponseResult queryZhcxZhd(@RequestBody City city, HttpSession session) {
        // TODO

        Map<String,Object> map = new HashMap<>();
        if (city.getDivcode()==null||city.getDivcode()=="")
            return null;
        try {
            List<?> res = riskManagementService.queryZhcxZhd(city, session);
            if (res == null || res.size() == 0) {
                return new ResponseResult(null,true,"没有查询到结果！",null);
            }

            int scount = city.getAnum() * city.getInum();
            int ecount = ("".equals(city.getAnum())) ? res.size() : city.getAnum() * (city.getInum() + 1); //若传入隐患点显示个数则按照传入的显示，若传入""则显示全部
            if (res.size() > scount) {
                res = res.subList(scount, res.size() < ecount ? res.size() : ecount);

                JSONObject jsonObject1 = new JSONObject();
                List<Jcca16AVo> jcca16AVos = monitoringManagementService.queryMonitorInfo(jsonObject1);//获取监测点
                List<Jcca16AVo> jcca16AVo = new ArrayList<>();

                List<JSONObject> res1 = new ArrayList<>();
                List<JSONObject> res2 = new ArrayList<>();

                for (int i = 0; i < res.size(); i++) {
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(res.get(i)));
                    String id = jsonObject.getString("id");
                    for (int j = 0; j < jcca16AVos.size(); j++) {
                        if (jcca16AVos.get(j).getJcca16a430().equals(id)) {
                            res1.add(jsonObject);
                            jcca16AVo.add(jcca16AVos.get(j));
                            jcca16AVos.remove(j);
                            break;
                        }
                    }
                }

                for (int a = 0; a < res.size(); a++) {
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(res.get(a)));
                    Integer zhdtype = Integer.valueOf(jsonObject.getString("zhdtype"));
                    zhdtype=zhdtype+8;
                    String str = "";
                    if (zhdtype < 10){
                        str="0"+zhdtype;
                    }else {
                        str=String.valueOf(zhdtype);
                    }
                    jsonObject.put("zhdtype",str);
                    res2.add(jsonObject);
                }

                map.put("total",res.size());
                map.put("data",res);
                map.put("data2",jcca16AVo);
                map.put("data1",res2);
                map.put("zonghedian",res1);

                return new ResponseResult(200,true,"查询成功",map);
            }
            return new ResponseResult(200,true,"没有更多！",null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResponseResult(200,false,e.getMessage(),null);
        }
    }

    @ApiOperation(value = "地图数据1")
    @PostMapping(value = "queryZhcxZhd1", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public ResponseResult queryZhcxZhd1(@RequestBody City city, HttpSession session) {
        // TODO

        Map<String,Object> map = new HashMap<>();
        if (city.getDivcode()==null||city.getDivcode()=="")
            return null;
        try {
            List<?> res = riskManagementService.queryZhcxZhd(city, session);
            if (res == null || res.size() == 0) {
                return new ResponseResult(null,true,"没有查询到结果！",null);
            }
            map.put("total",res.size());
            JSONObject jsonObject1 = new JSONObject();
            List<Jcca16AVo> jcca16AVo = monitoringManagementService.queryMonitorInfo(jsonObject1);

            List<Jcca16AVo> hs = new ArrayList<>();
            List<Jcca16AVo> cs = new ArrayList<>();
            List<Jcca16AVo> huangs = new ArrayList<>();
            List<Jcca16AVo> ls = new ArrayList<>();
            List<Jcca16AVo> hs1 = new ArrayList<>();
            List<Jcca16AVo> cs1 = new ArrayList<>();
            List<Jcca16AVo> huangs1 = new ArrayList<>();
            List<Jcca16AVo> ls1 = new ArrayList<>();

            for (int i = 0; i < jcca16AVo.size(); i++) {

                if ("1".equals(jcca16AVo.get(i).getJcca18a020())){
                    hs.add(jcca16AVo.get(i));
                }else if ("2".equals(jcca16AVo.get(i).getJcca18a020())){
                    cs.add(jcca16AVo.get(i));
                }else if ("3".equals(jcca16AVo.get(i).getJcca18a020())){
                    huangs.add(jcca16AVo.get(i));
                }else if ("4".equals(jcca16AVo.get(i).getJcca18a020())){
                    ls.add(jcca16AVo.get(i));
                }
            }

            List<JSONObject> resh = new ArrayList<>();
            List<JSONObject> resc = new ArrayList<>();
            List<JSONObject> reshuang = new ArrayList<>();
            List<JSONObject> resl = new ArrayList<>();

            int scount = city.getAnum() * city.getInum();
            int ecount = ("".equals(city.getAnum())) ? res.size() : city.getAnum() * (city.getInum() + 1); //若传入隐患点显示个数则按照传入的显示，若传入""则显示全部
            if (res.size() > scount) {
                res = res.subList(scount, res.size() < ecount ? res.size() : ecount);
                //将res转化为对象集合
                List<Yinhuan> list = JSON.parseArray(res.toString(), Yinhuan.class);
                Map<String, Long> groupByUserNameMap = list.stream().collect(Collectors.groupingBy(Yinhuan::getXian,Collectors.counting()));
                System.out.println("按照区县分组后结果："+groupByUserNameMap);


                 for (int i = 0; i < res.size(); i++) {
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(res.get(i)));
                    String id = jsonObject.getString("id");

                    for (int j = 0; j < hs.size(); j++) {
                        if (hs.get(j).getJcca16a430().equals(id)) {
                            resh.add(jsonObject);
                            res.remove(i);
                            hs1.add(hs.get(j));
                            hs.remove(j);
                            break;
                        }
                    }
                }

                for (int i = 0; i < res.size(); i++) {
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(res.get(i)));
                    String id = jsonObject.getString("id");
                    for (int j = 0; j < cs.size(); j++) {
                        if (cs.get(j).getJcca16a430().equals(id)) {
                            resc.add(jsonObject);
                            res.remove(i);
                            cs1.add(cs.get(j));
                            cs.remove(j);
                            break;
                        }
                    }
                }

                for (int i = 0; i < res.size(); i++) {
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(res.get(i)));
                    String id = jsonObject.getString("id");
                    for (int j = 0; j < huangs.size(); j++) {
                        if (huangs.get(j).getJcca16a430().equals(id)) {
                            reshuang.add(jsonObject);
                            res.remove(i);
                            huangs1.add(huangs.get(j));
                            huangs.remove(j);
                            break;
                        }
                    }
                }

                for (int i = 0; i < res.size(); i++) {
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(res.get(i)));
                    String id = jsonObject.getString("id");
                    for (int j = 0; j < ls.size(); j++) {
                        if (ls.get(j).getJcca16a430().equals(id)) {
                            resl.add(jsonObject);
                            res.remove(i);
                            ls1.add(ls.get(j));
                            ls.remove(j);
                            break;
                        }
                    }
                }

                map.put("hong",resh);
                map.put("hongjcd",hs1);

                map.put("chong",resc);
                map.put("chongjcd",cs1);

                map.put("huang",reshuang);
                map.put("huangjcd",huangs1);

                map.put("lan",resl);
                map.put("lanjcd",ls1);

                map.put("qx",groupByUserNameMap);


                return new ResponseResult(200,true,"查询成功",map);
            }
            return new ResponseResult(200,true,"没有更多！",null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResponseResult(200,false,e.getMessage(),null);
        }
    }

    @ApiOperation(value = "地图数据2")
    @PostMapping(value = "queryZhcxZhd2", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public ResponseResult queryZhcxZhd2(@RequestBody City city, HttpSession session) {
        // TODO

        Map<String,Object> map = new HashMap<>();
        if (city.getDivcode()==null||city.getDivcode()=="")
            return null;
        try {
            List<?> res = riskManagementService.queryZhcxZhd(city, session);
            if (res == null || res.size() == 0) {
                return new ResponseResult(null,true,"没有查询到结果！",null);
            }

            int scount = city.getAnum() * city.getInum();
            int ecount = ("".equals(city.getAnum())) ? res.size() : city.getAnum() * (city.getInum() + 1); //若传入隐患点显示个数则按照传入的显示，若传入""则显示全部
            if (res.size() > scount) {
                res = res.subList(scount, res.size() < ecount ? res.size() : ecount);
                for (int i = 0; i < res.size(); i++) {
                    System.out.println(res.get(i));
                }



                List<JSONObject> res1 = new ArrayList<>();
                List<JSONObject> res2 = new ArrayList<>();

                for (int i = 0; i < res.size(); i++) {
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(res.get(i)));
                    String id = jsonObject.getString("city");


                }


                map.put("total",res.size());
                map.put("data",res);

                map.put("data1",res2);
                map.put("zonghedian",res1);

                return new ResponseResult(200,true,"查询成功",map);
            }
            return new ResponseResult(200,true,"没有更多！",null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResponseResult(200,false,e.getMessage(),null);
        }
    }

    @ApiOperation(value = "隐患点查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "zhaa11a030", value = "市编码", required = true,defaultValue = "431200",  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "zhaa11a032", value = "县编码", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "zhaa11a024", value = "灾害类型01:滑坡 02:崩塌 03:泥石流 04:地面塌陷 06:地裂缝 07:地面沉降 00:不稳定斜坡",
                    required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "zhaa11a012", value = "统一编号", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "zhaa01c020", value = "隐患点年份", required = true,defaultValue = "2023", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "zhaa11a022", value = "灾害名称关键字", required = false, dataType = "String", paramType = "query"),
    })
    @PostMapping("getHiddenDangerPoint")
    @ResponseBody
    public ResponseResult getHiddenDangerPoint(@RequestBody JSONObject jsonObject) {
//        return ResponseResult.success(riskManagementService.getHiddenDangerPoint(jsonObject));
        return ResponseResult.success(riskManagementService.getHiddenDangerPointInfo(jsonObject));
    }

    /**
     * @Description:查询 首页灾情统计
     */
    @ApiOperation(value = "首页灾情统计")
    @PostMapping("queryZhdBysy")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(name = "city", value = "市编码",defaultValue = "431200", required = true,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "county", value = "县编码", required = false,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "home", value = "乡编码", required = false,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "years", value = "年份",defaultValue = "2023", required = true,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cxtypes", value = "查询类型(gmdj/xqdj/zqdj)",defaultValue = "gmdj", required = true,  dataType = "String", paramType = "query")
    })
    public ResponseResult queryZhdBysy(@RequestBody City city) {
        // TODO
        try {
            TimeZone.setDefault(TimeZone.getTimeZone("GMT+08"));
            List<?> res = riskManagementService.queryZhdBysy(city);
//            return new ResultObj("查询成功！", res, true);
            return new ResponseResult(200,true,"查询成功",res);
        } catch (Exception e) {
            e.printStackTrace();
//            return new ResultObj(e.getMessage(), null, false);
            return new ResponseResult(null,false,e.getMessage(),null);
        }
    }


//    @ApiOperation(value = "市各地区隐患点统计")
//    @PostMapping("queryKeypointTj")
//    @ResponseBody
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "city", value = "市编码",defaultValue = "431200", required = true,  dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "county", value = "县编码",defaultValue = "431200", required = true,  dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "years", value = "年份",defaultValue = "2023", required = true,  dataType = "String", paramType = "query")
//
//    })
//    public ResponseResult queryKeypointTj(@RequestBody QueryKeypoint request){
//        String city = request.getCity();
//        String years = request.getYear();
//        try {
//            String url = DbConfig.Uri + "ZHCXNew/queryKeypointTj?";
//            Map<String,Object> parmaters = new HashMap<>();
//            parmaters.put("city",city);
//            parmaters.put("years",years);
//            String res = UrlHttpRequest.httpPost(url,parmaters);
//            JSONObject obj = JSONObject.parseObject(res);
//            if (obj.getBoolean("status")){
//                JSONArray arr = obj.getJSONArray("data");
//                List<Object> list = JSONArray.parseArray(arr.toString(),Object.class);
////                return new ResultObj("查询成功", list, true);
//                return new ResponseResult(200,true,"查询成功",list);
//            }{
////                return new ResultObj("查询失败", null, false);
//                return new ResponseResult(null,false,"查询失败",null);
//            }
//        }catch (Exception e){
//            e.printStackTrace();
////            return new ResultObj("查询异常", null, false);
//            return new ResponseResult(null,false,"查询异常",null);
//        }
//    }






    /**
     * 规模、险情、灾情
     * @param request
     * @return
     */

    @ApiOperation(value = "规模等级/险情等级/灾情等级")
    @PostMapping("queryDataDcd")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(name = "city", value = "市编码",defaultValue = "431200", required = true,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "county", value = "县编码", required = false,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "home", value = "乡编码", required = false,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "years", value = "年份",defaultValue = "431200", required = true,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cxtypes", value = "查询类型(gmdj/xqdj/zqdj)",defaultValue = "gmdj", required = true,  dataType = "String", paramType = "query")
    })
//    public ResponseResult queryDataDcd(HttpServletRequest request){
    public ResponseResult queryDataDcd(@RequestBody QueryDataRequest request){
        String city = request.getCity();
        String county = request.getCounty();
        String home = request.getHome();
        String years = request.getYears();
        String cxtypes = request.getCxtypes();//类型
        try {
            String url = DbConfig.Uri + "ZHCXNew/queryDataDcd?";
            Map<String,Object> parmaters = new HashMap<>();
            parmaters.put("city",city);
            parmaters.put("county",county);
            parmaters.put("home",home);
            parmaters.put("years",years);
            parmaters.put("cxtypes",cxtypes);
            String res = UrlHttpRequest.httpPost(url,parmaters);
            JSONObject obj = JSONObject.parseObject(res);
            if (obj.getBoolean("status")){
                JSONArray arr = obj.getJSONArray("data");
                List<DcdData> list = JSONArray.parseArray(arr.toString(), DcdData.class);
                DcdType dcdType00 = new DcdType();
                dcdType00.setType("00");

                DcdType dcdType01 = new DcdType();
                dcdType01.setType("01");

                DcdType dcdType02 = new DcdType();
                dcdType02.setType("02");

                DcdType dcdType03 = new DcdType();
                dcdType03.setType("03");

                DcdType dcdType04 = new DcdType();
                dcdType04.setType("04");

                DcdType dcdType06 = new DcdType();
                dcdType06.setType("06");

                DcdType dcdType07 = new DcdType();
                /**
                 * 灾害类型(01:滑坡 02:崩塌 03:泥石流 04:地面塌陷 06:地裂缝 07:地面沉降 00:不稳定斜坡)
                 * 规模等级(滑坡、崩塌规模分为 A：巨型，B：大型，C：小型，D：中型，E：特大型；
                 * 其他灾种分为 A：巨型，B：大型，C：小型，D：中型)
                 */
                dcdType07.setType("07");
                for (int i=0;i<list.size();i++){
                    if ("00".equals(list.get(i).getZhaa11a024())){
                        if ("a".equals(list.get(i).getZhaa11a080())){
                            dcdType00.setA(list.get(i).getNum());
                        }else if ("b".equals(list.get(i).getZhaa11a080())){
                            dcdType00.setB(list.get(i).getNum());
                        }else if ("c".equals(list.get(i).getZhaa11a080())){
                            dcdType00.setC(list.get(i).getNum());
                        }else if ("d".equals(list.get(i).getZhaa11a080())){
                            dcdType00.setD(list.get(i).getNum());
                        }else if ("e".equals(list.get(i).getZhaa11a080())){
                            dcdType00.setE(list.get(i).getNum());
                        }
                    }else if ("01".equals(list.get(i).getZhaa11a024())){
                        if ("a".equals(list.get(i).getZhaa11a080())){
                            dcdType01.setA(list.get(i).getNum());
                        }else if ("b".equals(list.get(i).getZhaa11a080())){
                            dcdType01.setB(list.get(i).getNum());
                        }else if ("c".equals(list.get(i).getZhaa11a080())){
                            dcdType01.setC(list.get(i).getNum());
                        }else if ("d".equals(list.get(i).getZhaa11a080())){
                            dcdType01.setD(list.get(i).getNum());
                        }else if ("e".equals(list.get(i).getZhaa11a080())){
                            dcdType01.setE(list.get(i).getNum());
                        }
                    }else if ("02".equals(list.get(i).getZhaa11a024())){
                        if ("a".equals(list.get(i).getZhaa11a080())){
                            dcdType02.setA(list.get(i).getNum());
                        }else if ("b".equals(list.get(i).getZhaa11a080())){
                            dcdType02.setB(list.get(i).getNum());
                        }else if ("c".equals(list.get(i).getZhaa11a080())){
                            dcdType02.setC(list.get(i).getNum());
                        }else if ("d".equals(list.get(i).getZhaa11a080())){
                            dcdType02.setD(list.get(i).getNum());
                        }else if ("e".equals(list.get(i).getZhaa11a080())){
                            dcdType02.setE(list.get(i).getNum());
                        }
                    }else if ("03".equals(list.get(i).getZhaa11a024())){
                        if ("a".equals(list.get(i).getZhaa11a080())){
                            dcdType03.setA(list.get(i).getNum());
                        }else if ("b".equals(list.get(i).getZhaa11a080())){
                            dcdType03.setB(list.get(i).getNum());
                        }else if ("c".equals(list.get(i).getZhaa11a080())){
                            dcdType03.setC(list.get(i).getNum());
                        }else if ("d".equals(list.get(i).getZhaa11a080())){
                            dcdType03.setD(list.get(i).getNum());
                        }else if ("e".equals(list.get(i).getZhaa11a080())){
                            dcdType03.setE(list.get(i).getNum());
                        }
                    }else if ("04".equals(list.get(i).getZhaa11a024())){
                        if ("a".equals(list.get(i).getZhaa11a080())){
                            dcdType04.setA(list.get(i).getNum());
                        }else if ("b".equals(list.get(i).getZhaa11a080())){
                            dcdType04.setB(list.get(i).getNum());
                        }else if ("c".equals(list.get(i).getZhaa11a080())){
                            dcdType04.setC(list.get(i).getNum());
                        }else if ("d".equals(list.get(i).getZhaa11a080())){
                            dcdType04.setD(list.get(i).getNum());
                        }else if ("e".equals(list.get(i).getZhaa11a080())){
                            dcdType04.setE(list.get(i).getNum());
                        }
                    }else if ("06".equals(list.get(i).getZhaa11a024())){
                        if ("a".equals(list.get(i).getZhaa11a080())){
                            dcdType06.setA(list.get(i).getNum());
                        }else if ("b".equals(list.get(i).getZhaa11a080())){
                            dcdType06.setB(list.get(i).getNum());
                        }else if ("c".equals(list.get(i).getZhaa11a080())){
                            dcdType06.setC(list.get(i).getNum());
                        }else if ("d".equals(list.get(i).getZhaa11a080())){
                            dcdType06.setD(list.get(i).getNum());
                        }else if ("e".equals(list.get(i).getZhaa11a080())){
                            dcdType06.setE(list.get(i).getNum());
                        }
                    }else if ("07".equals(list.get(i).getZhaa11a024())){
                        if ("a".equals(list.get(i).getZhaa11a080())){
                            dcdType07.setA(list.get(i).getNum());
                        }else if ("b".equals(list.get(i).getZhaa11a080())){
                            dcdType07.setB(list.get(i).getNum());
                        }else if ("c".equals(list.get(i).getZhaa11a080())){
                            dcdType07.setC(list.get(i).getNum());
                        }else if ("d".equals(list.get(i).getZhaa11a080())){
                            dcdType07.setD(list.get(i).getNum());
                        }else if ("e".equals(list.get(i).getZhaa11a080())){
                            dcdType07.setE(list.get(i).getNum());
                        }
                    }
                }
                List<DcdType> reslist = new ArrayList<>();
                reslist.add(dcdType01);
                reslist.add(dcdType02);
                reslist.add(dcdType03);
                reslist.add(dcdType04);
                reslist.add(dcdType06);
                reslist.add(dcdType07);
                reslist.add(dcdType00);
//                return new ResultObj("查询成功", reslist, true);
                return new ResponseResult(200,true,"查询成功",reslist);
            }else {
//                return new ResultObj("查询失败", null, false);
                return new ResponseResult(null,false,"查询失败",null);
            }
        }catch (Exception e){
            e.printStackTrace();
//            return new ResultObj("查询异常", null, false);
            return new ResponseResult(null,false,"查询异常",null);
        }
    }


    @ApiOperation(value = "风险区信息查询")
    @PostMapping("queryRiskZoneInfo")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(name = "city", value = "市编码",defaultValue = "431200", required = true,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "county", value = "县编码", required = false,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "riskLevel", value = "风险等级(极高、高、中、低)", required = false,  dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "keyword", value = "风险区名称关键字", required = false,  dataType = "String", paramType = "query")
    })
    public ResponseResult queryRiskZoneInfo(@RequestBody JSONObject jsonObject){
        return ResponseResult.success(riskManagementService.queryRiskZoneInfo(jsonObject));
    }


}


